package com.yichen.rent.service;

import com.yichen.rent.response.AreaResonse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

@Service
public class AreaService {
    @Autowired
    private RestTemplate restTemplate;

    @Value("${areaurl}")
    private String areaUrl;

    public AreaResonse cityInfo(String name) {
        AreaResonse areaResonse = restTemplate.getForObject(areaUrl +"&keywords="+ name, AreaResonse.class);
        return areaResonse;
    }
}
